home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1985 September
/
Ahoy_Magazine_85-09_1985_Double_L.d64
/
dice simulator
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
602b
|
25 lines
0 rem << rr21-1 >>
1 print"[147]":poke53280,3:poke53281,6
2 rem -- dice simulator --
3 rem rupert report #21
4 rem
5 print " randomly simulate the outcome for rolling three dice..."
6 rem outcomes for rolling three dice
7 for d=1to2000:next
8 rem >>determine the probability that
9 rem the sum is eleven
10 n=1 : r$=chr$(18) :rem rvs on
20 print chr$(147);
30 print tab(15)r$;"<< # rolls "
40 print tab(15)r$;"<< # success "
50 print tab(15)r$;"<< % probability "
60 a=int(rnd(0)*6)+1
70 b=int(rnd(0)*6)+1
80 c=int(rnd(0)*6)+1
90 ttl=a+b+c
100 if ttl=11 then sxcs=sxcs+1
110 print chr$(19);n : print sxcs
120 prob=100*sxcs/n : print prob
130 n=n+1
140 goto 60